/*
 *  testparallelepipede.cpp
 *  Ray Tracing
 *
 *  Created by Jean-Marc Comby on Fri May 21 2004.
 *  Copyright (c) 2004. All rights reserved.
 *
 */

#include "testparallelepipede.hpp"

void affichePara()
{
	Coord a(1,2,3);
	Vecteur v1(-1,1,2),v2(1,3,1),v3(4,-1,0);
	Parallelepipede test(a,v1,v2,v3);
	
	Coord tab[3],i1(3,3,4.5),i2(2.5,4,5.5),i3(7,7,7),o(1.5,2.5,2);
	tab[0]=i1;
	tab[1]=i2;
	tab[2]=i3;
	VecteurU v(0,0,1);
	Rayon ray(o,v);
	for (unsigned int i(0); i<3; i++)
	{
		std::cout << "Point" << std::endl;
		tab[i].affiche();
		std::cout << "isIn" << std::endl;
		std::cout << test.isIn(tab[i]) << std::endl;
		std::cout << "isOn" << std::endl;
		std::cout << test.isOn(tab[i]) << std::endl;
		VecteurU tmp;
		std::cout << "Normal" << std::endl;
		tmp=test.normale(tab[i]);
		if (tmp!=VecteurU(9999,9999,9999))
			tmp.affiche();
		else
			std::cout << "Pas de Normal possible" << std::endl;
	}
	std::cout << "Intersection" << std::endl;
	Coord tmp1;
	tmp1=test.intersect(ray);
	if (tmp1==NullePart)
		std::cout << "pas d intersection avec rayon" << std::endl;
	else
		tmp1.affiche();
}
